package org.simpleframework.mvc.render.impl;

import org.simpleframework.mvc.RequestProcessorChain;
import org.simpleframework.mvc.render.ResultRender;

import javax.servlet.http.HttpServletResponse;

/**
 * 资源找不到时使用的渲染器
 *
 * @author: Oliver
 * @time: 2020/12/29/19:59
 */
public class ResourceNotFoundResultRender implements ResultRender {
    private String method;
    private String path;

    public ResourceNotFoundResultRender(String methodPath, String method) {
        this.method = method;
        this.path = methodPath;
    }

    @Override
    public void render(RequestProcessorChain chain) throws Exception {
        HttpServletResponse response = chain.getResponse();
        response.sendError(HttpServletResponse.SC_NOT_FOUND, "获取不到对应的请求资源：请求路径[" + path + "]" + "请求方法[" + method + "]");

    }
}
